package com.jic.market.impl.rest.allocation;


import com.jic.market.common.enums.CostAllocationFlagEnum;
import com.jic.market.entity.AllocationModel;
import com.jic.market.request.after.TellAddAllocationRequest;
import com.jic.market.request.rest.allocation.CollectionThemeInfoRequest;
import com.jic.market.response.PatchGrouponThemeResponse;
import com.jic.market.response.rest.allocation.QueryAllocationAndThemeInfoResponse;
import com.jic.market.service.PatchGrouponThemeService;
import com.jic.market.service.allocation.PromotionAddAllocationStrategy;
import com.jic.market.service.rest.allocation.QueryPromotionForAllocationStrategy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author xuyongliang
 * @version V1.0
 * @className PromotionAddAllocationStrategyGroupon
 * @description 拼团活动信息查询策略
 * @date 2020/4/10
 */
@Slf4j
@Service("queryPromotionForAllocationGroupon")
public class QueryPromotionForAllocationStrategyGroupon implements QueryPromotionForAllocationStrategy {

    @Autowired
    PatchGrouponThemeService patchGrouponThemeService;

    @Override
    public QueryAllocationAndThemeInfoResponse collectionThemeInfo(CollectionThemeInfoRequest request) {
        log.info("--------进入拼团活动信息查询策略request--{}-----",request);
        String promotionCode = request.getPromotionCode();
        PatchGrouponThemeResponse promotion = patchGrouponThemeService.getByPromotionCode(promotionCode);

        QueryAllocationAndThemeInfoResponse model =new QueryAllocationAndThemeInfoResponse();
        model.setStartTime(promotion.getStartTime());
        model.setEndTime(promotion.getEndTime());
//        model.setProUserType(promotion.getProUserType());
        model.setMailType(promotion.getMailType());
        model.setCustomerLimit(promotion.getCustomerLimit());
        model.setOfferedCustomerLimit(promotion.getOfferedCustomerLimit());
        model.setAutoCompleteTime(promotion.getAutoCompleteTime());
        model.setIndividualJoinType(promotion.getIndividualJoinType());
        model.setIndividualJoinTime(promotion.getIndividualJoinTime());

        return model;

    }
}
